package com.bwie.controller;
import com.bwie.pojo.User;
import com.bwie.service.UserService;
import com.bwie.service.impl.UserServiceImpl;
import com.bwie.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import org.springframework.beans.factory.annotation.Autowired;

/**
* 用户表(t_user)表控制层
*
* @author xxxxx
*/
@RestController
@RequestMapping("/user/index/")
@Api(tags = "用户模块")
public class UserController {
/**
* 服务对象
*/
    @Autowired
    private UserService userService;


    @ApiOperation("test run")
    @PostMapping("firstTestRun")
    public R firstTestRun(@RequestBody User user){
        return userService.firstTestRun(user);
    }

    @ApiOperation("用户登录")
    @PostMapping("login")
    public R login(@RequestBody @Validated User user){
        return userService.login(user);
    }

    @ApiOperation("获取专属菜单")
    @GetMapping("getMenuByUserId")
    public R getMenuByUserId(){
        return userService.getMenuByUserId();
    }

    @ApiOperation("feign调用用户接口")
    @GetMapping("getUserNameToSave/{id}")
    public User getUserNameToSave(@PathVariable("id")Integer id){
        return userService.getUserNameToSave(id);
    }
}
